<template>
	<view class="content">
		<view class="row">
			<view class="col-7">
				手机号
			</view>
			<view class="col-17">
				<input type="text" class="t_right" v-model="objPage.mobile" placeholder="请输入11位手机号" />
			</view>
		</view>
		<view class="row">
			<view class="col-7">
				姓名
			</view>
			<view class="col-17">
				<input type="text" class="t_right" v-model="objPage.name" placeholder="请输入联系人姓名(选填)" />
			</view>
		</view>
		<view class="btn">
			<button type="primary" @click="submit()">保存</button>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				objPage:{
					"mobile": "",
					"name": ""
				}
			}
		},
		methods: {
			async submit(){
				if(this.objPage.mobile == ""){
					this.$public.showToast('手机号为必填项');
					return
				}
				let res = await this.$api.request(this.$api.public.addlist,this.objPage);
				if(res == undefined){
					this.$public.showToast('添加成功');
					setTimeout(()=>{
						uni.navigateBack()
					},800)
				}
			}
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #f5f5f5;
	}
	
	.content{
		padding-top: 21rpx;
	}
	
	.row{
		width: 92%;
		padding: 0 4%;
		border-bottom: 1px solid #ededed;
		height: 116rpx;
		line-height: 116rpx;
		color: #333333;
		background-color: #FFFFFF;
		input{
			height: 116rpx;
			line-height: 116rpx;
		}
	}
	
	.btn{
		width: 92%;
		padding: 0 4%;
		margin-top: 60rpx;
		button{
			height: 96rpx;
			line-height: 96rpx;
			border-radius: 48rpx;
			background-color: #6CBF30;
		}
	}
</style>
